using UnityEngine;
using System.Collections;

public class BasicTarget : MonoBehaviour
{
	public int	m_iLives	= 3;
	
	
	// Update is called once per frame
	void Update ()
	{
		
	}
	
    void OnTriggerEnter (Collider _cOther) 
	{
		if(_cOther.gameObject.CompareTag("PlayerBullets"))
		{
			m_iLives--;
			transform.localScale = transform.localScale * 0.5f;
			if(m_iLives <= 0){
				Destroy(gameObject);
			}
			
			// Destroy bullet
			Destroy(_cOther.gameObject);
		}
	}
	
	void OnCollisionEnter(Collision _cOther)
	{
		if(_cOther.gameObject.CompareTag("PlayerBullets"))
		{
			m_iLives--;
			transform.localScale = transform.localScale * 0.5f;
			if(m_iLives <= 0){
				Destroy(gameObject);
			}
			
			// Destroy bullet
			Destroy(_cOther.gameObject);
		}
	}
}

